-- Sets up the script's main plugins table --
Hyperion.Plugins = { }

function Hyperion.Plugins.Load( schema )
	if ( SERVER ) then
		for k, v in pairs( file.Find( "Hyperion/gamemode/schemas/" .. schema .. "/plugins/server/*.lua", "LUA" ) ) do
			include( "schemas/" .. schema .. "/plugins/server/" .. v )
		end

		for k, v in pairs( file.Find( "Hyperion/gamemode/schemas/" .. schema .. "/plugins/client/*.lua", "LUA" ) ) do
			AddCSLuaFile( "schemas/" .. schema .. "/plugins/client/" .. v )

			include( "schemas/" .. schema .. "/plugins/client/" .. v )
		end

		for k, v in pairs( file.Find( "Hyperion/gamemode/schemas/" .. schema .. "/plugins/shared/*.lua", "LUA" ) ) do
			AddCSLuaFile( "schemas/" .. schema .. "/plugins/shared/" .. v )

			include( "schemas/" .. schema .. "/plugins/shared/" .. v )
		end
	elseif ( CLIENT ) then
		for k, v in pairs( file.Find( "Hyperion/gamemode/schemas/" .. schema .. "/plugins/client/*.lua", "LUA" ) ) do
			include( "schemas/" .. schema .. "/plugins/client/" .. v )
		end

		for k, v in pairs( file.Find( "Hyperion/gamemode/schemas/" .. schema .. "/plugins/shared/*.lua", "LUA" ) ) do
			include( "schemas/" .. schema .. "/plugins/shared/" .. v )
		end
	end

	table.insert( Hyperion.Plugins, Hyperion.Plugin )
end

-- Registers a plugin --
function Hyperion.Plugins.Register()
	if ( Hyperion.Plugin.Name and Hyperion.Plugin.Author and Hyperion.Plugin.Version and Hyperion.Plugin.Description and Hyperion.Plugin.Initialize != nil ) then
		MsgN( "[Hyperion] Loaded plugin: '" .. Hyperion.Plugin.Name .. "', made by: '" .. Hyperion.Plugin.Author .. "'" )

		Hyperion.Plugin.Initialize()
	end
end